package com.yunji.aggregate.model.vo.container;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunji.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author : peter-zhu
 * @date : 2024/12/19 16:22
 * @description : TODO
 **/
@Data
public class CabinetCellVO {

    @ApiModelProperty("主键ID")
    @Excel(name = "主键ID", width = 15)
    @TableId(type = IdType.AUTO)
    private Long cellId;

    @ApiModelProperty(value = "货柜ID")
    @Excel(name = "货柜ID", width = 15)
    private Long containerId;

    @ApiModelProperty(value = "商品ID", required = true)
    @Excel(name = "商品ID", width = 15)
    private Long productId;

    @ApiModelProperty("商品名称")
    private String productName;

    @ApiModelProperty("价格")
    private BigDecimal price;

    @ApiModelProperty("成本价")
    private BigDecimal costPrice;

    @ApiModelProperty("折扣价")
    private BigDecimal discountPrice;

    @ApiModelProperty("商品图片")
    private String albumPics;

    @ApiModelProperty(value = "格子号", required = true)
    @Excel(name = "格子号", width = 15)
    private Integer ordinal;

    @ApiModelProperty("开锁状态(0-开启 1-关闭)")
    @Excel(name = "开锁状态(0-开启 1-关闭)", width = 15)
    private Integer unlock;

    @ApiModelProperty("格子状态 0-无商品 1-有商品")
    @Excel(name = "格子状态 0-无商品 1-有商品", width = 15)
    private Integer status;

    @ApiModelProperty("消息发送 0-未发送 1-已发送")
    private Integer sendStatus;

    @ApiModelProperty(value = "状态最后更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date statusUpdateTime;

    @ApiModelProperty("商品数量")
    private Integer productQuantity;

    @ApiModelProperty("商品上限")
    private Integer ceilingQuantity;

    @ApiModelProperty("缺货商品数量")
    private Integer stockOutQuantity;

    public Integer getStockOutQuantity() {
        return this.ceilingQuantity - this.productQuantity;
    }

}
